import { Component,ElementRef,OnInit,Input,ViewChild, Output, EventEmitter,AfterViewInit} from '@angular/core';
import { Http } from '@angular/http';
import { HttpClientModule, HttpClient, HttpErrorResponse } from '@angular/common/http';

import { Service } from '../../../server/server';
import { CudTableService } from '../../../public/serve/cud-table/cud-table.service';
declare var $: any;

@Component({
  selector: 'app-task-search',
  templateUrl: './task-search.component.html'
})
export class TaskSearchComponent implements OnInit {

  constructor(private server :Service,private http: Http,private tableListService:CudTableService) { }

  ngOnInit() {
    //查询数据初始化
    this.srarchData = {
      // startTime:'',
      // endTime:'',
      queryCriteria:'',
    }
  }

  @Output()
  searchOutput: EventEmitter<any> = new EventEmitter();

  public srarchData:any;
  //查询
  search(){
    // let url = this.server.baseUrl+'admin/tasks/list';
    // //console.log(this.srarchData.startTime)
    // let data = {
    //   // startTime:this.server.formatDate(this.srarchData.startTime) || '',
    //   // endTime:this.server.formatDate(this.srarchData.endTime) || '',
    //   queryCriteria:this.srarchData.queryCriteria,
    //   pageNo:1,
    //   pageSize:20, 
    // }
    // //console.log(data)
    // this.tableListService.getTableList(url, data).then((data: any) => {
    //   //console.log(data.length)
    //   this.server.tasksearcheventEmit.emit(data);
    // }).catch();
    this.searchOutput.emit(this.srarchData.queryCriteria);
  }

  //响应搜索
  changesearch(){
    this.search();
  }

}
